<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>兑奖列表</title>
    <script src="/public/sp/js/mui.min.js"></script>
    <link href="/public/sp/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/public/sp/css/style.css" />
    <link rel="stylesheet" href="/public/sp/css/iconfont.css" />
    <link rel="stylesheet" href="/public/sp/css/shoupiao.css" />
</head>
<body>
	<header class="mui-bar mui-bar-nav">
	    <h1 class="mui-title">兑奖列表</h1>
	</header>
	<div class="mui-content cash_content">
	    <ul class="cash_nav clearfix">
			<li style="width: 60%;">奖品名称</li>
			<li style="width: 40%;">兑奖时间</li>
		</ul>   
		{if count($list)==0}
			<div class="none">
				<p class="iconfont icon-404"></p>
				<p>很抱歉，暂无记录</p>
			</div>	    		
		{/if}
		<ul class="cash_list">
			{foreach name="list" item="l"}		  	
		    	<li class="clearfix">
		    		<span style="width: 60%;" class="name">{$l.name}</span>
		    		<span style="width: 40%;" class="time">{$l.add_time}</span>
		    	</li>		    	    	   	    
			{/foreach}
		</ul>	
		<div class="footer"><img src="/public/sp/images/bac_sj3.jpg"></div>
	</div>
	
</body>
{block name="js"}
<script type="text/javascript" src="/public/static/layui/layui.all.js"></script>
<script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
<script type="text/javascript">
	function hx(id){
		layer.prompt({
		  title: '请输入核销密码'
		}, function(value, index, elem){
			hexiao(id,value);		  
		});
	}

	//确认核销
	function hexiao(id,pwd) {
		$.ajax({
			type: 'post',
			url: "{:url('index/index/hexiao')}",
			dataType: 'json',
			data: {
				id: id,
				pwd: pwd
			},
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
					  icon: 1,
					  time: 1000 //2秒关闭（如果不配置，默认是3秒）
					}, function(){
						location.href = "{:url('index/index/cash_list')}";
					});
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			},
			error: function(data) {
				console.log(data.msg);
			}
		});
	}
</script>
{/block}
</html>
